﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XXVIII.Entity;

namespace XXVIII.DAL.IDAL
{
    public interface IFormDAL
    {

        /// <summary>
        /// 增加数据
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="keyValue"></param>
        /// <returns></returns>
        bool Add(string tableName, Dictionary<string, string> keyValue);

        /// <summary>
        /// 移除数据
        /// </summary>
        /// <param name="table"></param>
        /// <param name="andOrLikeList"></param>
        /// <returns></returns>
        bool Delete(string tableName, List<TableAndOrLikeEntity> andOrLikeList);

        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="keyValue"></param>
        /// <returns></returns>
        bool Update(string tableName, Dictionary<string, string> keyValue,List<TableAndOrLikeEntity> andOrLikeList);

        /// <summary>
        /// 查询数据
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="andOrLikeList"></param>
        /// <returns></returns>
        DataTable Get(string tableName, List<TableAndOrLikeEntity> andOrLikeList);

        /// <summary>
        /// 查询数据
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="andOrLikeList"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        DataTable GetByPage(string tableName, List<TableAndOrLikeEntity> andOrLikeList,ref DBPageBase page);

        /// <summary>
        /// 创建表结构
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="columns"></param>
        /// <returns></returns>
        bool CreateSignTable(string tableName, List<CreateCloumnEntity> columns);

        /// <summary>
        /// 验证表是否存在
        /// </summary>
        /// <param name="tableName"></param>
        /// <returns></returns>
        bool CheckTableExist(string tableName);

        /// <summary>
        /// 移除 表
        /// </summary>
        /// <param name="tableName"></param>
        /// <returns></returns>
        bool DropSignTable(string tableName);

        /// <summary>
        /// 查询数据 sql
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        DataTable Get(string sql);

        /// <summary>
        /// 执行sql
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        bool ExecuteSql(string sql);

        /// <summary>
        /// 查询表 结构及核心属性
        /// </summary>
        /// <param name="tableName"></param>
        /// <returns></returns>
        List<TablePropertyEntity> GetTableProperty(string tableName);

        /// <summary>
        /// 记录创建表信息
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="customJson"></param>
        /// <param name="isJoin"></param>
        void RecordToTable(string tableName, string customJson, bool isJoin = false);

        /// <summary>
        ///  移除 记录创建表信息
        /// </summary>
        /// <param name="tableName"></param>
        void UnRecordToTable(string tableName);
    }
}
